package com.limbo.showapp.presenter;

import com.limbo.showapp.base.BasePresenter;
import com.limbo.showapp.bean.BannerBean;
import com.limbo.showapp.bean.HotBean;
import com.limbo.showapp.constant.AppConstant;
import com.limbo.showapp.model.BannerModel;
import com.limbo.showapp.model.MainModel;
import com.limbo.showapp.rxHttp.HttpObserver;
import com.limbo.showapp.util.SPUtils;
import com.limbo.showapp.view.IHttpView;

/**
 * Created by wangqi on 2018/9/5.
 */

public class MainPresenter extends BasePresenter<IHttpView,MainModel> {
    @Override
    protected MainModel getModel() {
        return new MainModel();
    }

    public void getHotList() {
        mModel.getHotList(new HttpObserver<HotBean>() {
            @Override
            protected void onHttpError(Throwable e) {
                if (getView() != null){
                    getView().onError(e.getMessage());
                }
            }

            @Override
            protected void onHttpSuccess(HotBean bean) {
                if (getView() != null)
                    getView().onSuccess(bean);
            }
        });
    }
}
